package cn.sh.library.mgts.framework.schedule;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.stereotype.Component;

@Component
public class SyncDataSchedule {
	
	
	@Autowired()@Qualifier("executor")
	ThreadPoolTaskExecutor executor;
	
	@Value("${syncdata}")
	private boolean isSyncData;
	
	private static Logger logger = LoggerFactory.getLogger(SyncDataSchedule.class);

//	@Scheduled(cron = "0 0 1 1 * ?")
	public void syncAllData() {
		if(isSyncData) {
		}
	}

	@Scheduled(cron = "0 0 2 * * ?")
	public void syncDailyData() {
//		bulkSearvice.bibDataUpdate();
//		&& DateUtils.getFragmentInDays(new Date(), Calendar.MONTH) > 1
		logger.info("开始执行定时任务，是否需要同步：{}", isSyncData);
		if(isSyncData ) {
			
		}
		logger.info("结束执行定时任务，是否需要同步：{}", isSyncData);
	}

}
